Electric power system secondary drawing image-text separation method

By writing automated CAD plug-ins and using UNet networks for training, automatic drawing separation of secondary drawings of power system is achieved, solving the problems of inefficiency and difficulty in ensuring accuracy in the digitalization process of drawings in the existing technology, and improving drawing information processing accuracy and efficiency.

CN119479004APending Publication Date: 2025-02-18YANGZHOU HAOCHEN POWER DESIGN CO LTD +1
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202411609256.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-12
Publication Date
2025-02-18

AI Technical Summary

Technical Problem

The prior art has problems such as inefficiency, difficulty in ensuring accuracy, poor consistency, difficult version control, large workload and high cost in the digitalization process of power system secondary drawings, especially the interweaving of lines and text. Next, it will increase the difficulty of identifying and extracting drawing information.

Method used

By writing an automated CAD plug-in, using the Pyautocad library to process CAD drawings, export the original drawing, line sub-paint and text sub-paint, and trained using the UNet network to obtain a general graphic separation model to realize automatic graphic separation of drawings.

Benefits of technology

It improves the accuracy and efficiency of drawing information processing, reduces dependence on data sets, optimizes the entire drawing processing process, and lays a solid foundation for the accurate extraction and effective utilization of drawing information.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119479004A_ABST
    Figure CN119479004A_ABST
Patent Text Reader

Abstract

The invention discloses a secondary drawing image-text separation method of a power system, and relates to the technical field of power systems. Comprising the following steps: 1) data preparation; 2) data training; and 3) drawing segmentation by using an image-text separation model to obtain a character sub-graph and a line sub-graph. During work, the whole drawing processing flow is optimized, dependence on a data set is reduced, the accuracy and efficiency of drawing processing are improved, and a solid foundation is laid for accurate extraction and effective utilization of drawing information.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of power systems, and in particular to a method for separating images and texts from secondary drawings of power systems. Background Art

[0002] With the advancement of science and technology and the increasing complexity of power systems, the early power secondary drawings stored in bitmap form no longer meet the needs of modern power systems. In this context, exploring methods for drawing digitization has become a key research area for current development. Compared with the traditional manual drawing digitization method, there are problems such as low efficiency, difficulty in ensuring accuracy, poor consistency, difficulty in version control, large workload and high cost.

[0003] The secondary drawings of the power system contain a large number of wire relationships, various components, tables and text annotations. Among them, lines constitute the elements of components, wire relationships, tables, etc., and text mainly plays the role of annotation, naming and searching. These elements are an important basis for the operation, maintenance and transformation and upgrading of the power system. However, in the actual drawing recognition process, the interweaving of lines and text interferes with each other, making it more difficult to identify and extract drawing information. Text annotations are closely related to the topological relationship of the circuit diagram, which may interrupt the continuity of the line and affect the correct understanding of the line connection relationship and information extraction. At the same time, the mutual interference between lines and text will reduce the recognition accuracy. The interweaving of lines may be mistaken for part of the text, and the text annotation may also be misjudged as a graphic element. This mutual interference greatly increases the difficulty of recognition.

[0004] With the development of information and intelligent power system, the demand for converting traditional paper drawings into digital drawings is increasing. How to convert and improve reliability is an urgent problem to be solved. Summary of the invention

[0005] In view of the above problems, the present invention proposes a method for separating text and image of secondary drawings of a power system with improved accuracy and reliability.

[0006] The technical solution of the present invention is: a method for separating text and images from secondary drawings of a power system, comprising the following steps: 1) Data preparation: Based on CAD drawings of the same style, by writing an automated CAD plug-in, the drawings can be exported with the same resolution and size as the original drawing, line sub-drawings and text sub-drawings. Figure 3 Picture; 2) Data training: The original image, line sub-image and text sub-image derived from data preparation are used as training data sets; the original image is used as the input data of the model, while the line sub-image and text sub-image are used as the corresponding model output data. The UNet network is used for training to obtain a universal image-text separation model. 3) Use the image-text separation model to segment the drawing to obtain text sub-images and line sub-images.

[0007] An automated CAD plug-in is written based on the Pyautocad library to filter out the text part in the original drawing, obtain pure text sub-images and line sub-images, and then export them into bitmaps to obtain the original image, text sub-images and line sub-images.

[0008] Write automated CAD plug-ins based on the Pyautocad library, including: 1.1) Environment preparation: Install Python and Pyautocad libraries, and ensure that AutoCAD supports ActiveXAutomation programs to control AutoCAD; 1.2) Write a plug-in: Write a Python script that will run as a plug-in and use the API interface provided by the Pyautocad library to establish a connection with AutoCAD; The functional logic of the plugin is: distinguish lines and texts by analyzing objects in the drawing; 1.3) Plug-in installation and testing: Install the written plug-in into the CAD software for testing and debugging; specifically: open the CAD drawing file to be processed through the plug-in; loop through all graphic entity objects in the CAD drawing, filter out text and line elements according to the attributes of the objects, and store them separately; 1.4) Graphics export: Determine and set the parameters of the image to be exported, ensuring that the exported images have the same specifications; use Pyautocad's image export function to export the original image, text sub-image, and line sub-image respectively.

[0009] Step 2) includes: 2.1) Data processing 2.11) Convert the original image to grayscale and retain the brightness information; divide the pixel value in the grayscale image by 255 and normalize the data to between 0 and 1; 2.12) Increase data diversity through rotation, flipping, and scaling methods; 2.2) Building the UNet model 2.21) The model architecture includes an encoder and a decoder, It also includes skip connections to fuse feature maps from the encoder with those from the decoder; 2.22) The loss function selects the cross entropy loss function; 2.3) Training process 2.31) The processed original image is used as the model input, and through continuous convolution pooling in the encoder, the channel is doubled each time to obtain several intermediate features; 2.32) Then decode and restore the image spatial resolution through continuous transposed convolution resize function, halving the channel each time to obtain the intermediate features; 2.33) The intermediate features at the same position between the encoder and decoder are fused through a span connection and finally mapped to two-channel outputs, which respectively represent the predicted line sub-image and text sub-image information; 2.34) Compare the output segmentation map of the model with the corresponding true segmentation map and calculate the loss function; calculate the gradient of the model according to the back propagation algorithm and update the model parameters according to the gradient information; 2.35) Repeat the above steps and perform iterative training to finally obtain the general image-text separation model for secondary drawings of power system.

[0010] In the work, the present invention can efficiently obtain training data sets from stock drawings by writing automated scripts through pyautocad, and the whole process does not require manual labeling. Compared with the traditional manual time-consuming and error-prone operation method, the efficiency and quality are greatly improved. The robustness of Unet is also utilized, and through image-to-image learning, a model that can automatically separate images and texts is trained according to the training data set (i.e., a model that decomposes the original image into line sub-images + text sub-images). After completing the image and text separation, it brings great convenience to subsequent processing such as text detection and recognition, component detection, etc. It not only optimizes the entire drawing processing flow, reduces the dependence on the data set, and improves the accuracy and efficiency of drawing processing, but also lays a solid foundation for the accurate extraction and effective use of drawing information. BRIEF DESCRIPTION OF THE DRAWINGS

[0011] In order to more clearly illustrate the specific implementation of the present invention or the technical solution in the prior art, the following briefly introduces the drawings required for the specific implementation or the prior art description. In the drawings, each part is not necessarily drawn according to the actual scale.

[0012] Figure 1 It is a schematic diagram of the architecture of UNet image-text separation in the present invention; Figure 2 It is a sample schematic diagram output from data preparation by the automated CAD plug-in of the present invention; Figure 3 It is a schematic diagram of the image-text separation result of the trained UNet of the present invention. DETAILED DESCRIPTION

[0013] The technical solutions in the embodiments of the present invention will be described clearly and completely below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments.

[0014] The secondary drawings of the power system are divided into two types: text and lines. The present invention uses existing CAD drawings, combined with automation plug-ins, to export them into three sub-pictures: original picture, text, and line, so as to obtain a large number of sample drawings. The obtained sample drawings are used to train UNet to obtain a universal image-text separation model, and a large number of early scanned drawings are processed to separate them into text sub-pictures and line sub-pictures to avoid mutual interference in the text and line recognition process. Among them, the text becomes simple on the text sub-picture, eliminating the interference of lines. Subsequent detection such as component detection and connection relationship detection also become clear on the line sub-picture, improving the efficiency and accuracy of subsequent drawing recognition.

[0015] Specifically, refer to Figure 1-3 The present invention provides a method for separating text and images from secondary drawings of a power system, comprising: 1) Data preparation Based on CAD drawings of the same style, that is, CAD drawings with similar design standards, symbol representations, text styles and sizes, overall layouts, and scale drawing conventions, by writing an automated CAD plug-in, the drawings are exported with pure text sub-pictures and line sub-pictures of the same resolution and size, and the original drawings, line sub-pictures, and text sub-pictures are obtained. Figure 3 drawings, thereby obtaining a large number of sample drawings.

[0016] Pyautocad is a library for simplifying AutoCAD ActiveX Automation scripting in Python, which allows users to interact with AutoCAD through Python code to perform various drawing and editing tasks.

[0017] The present invention writes a plug-in for a specific style of CAD drawings, utilizes the function of the Pyautocad library, and separates text and lines according to the inherent properties of objects in the CAD drawings (font style of text, type of lines, etc.). The plug-in is only applicable to CAD drawing formats that can be recognized and processed by Pyautocad.

[0018] The present invention writes an automated CAD plug-in based on the Pyautocad library, which can filter out the text part in the original drawing to obtain pure text sub-images and line sub-images, and then export them into bitmaps to obtain the original image, text sub-images, and line sub-images.

[0019] 1.1) Environment preparation: Install Python and Pyautocad libraries, and ensure that AutoCAD supports ActiveXAutomation programs to control AutoCAD.

[0020] 1.2) Write a plug-in: Write a Python script, which will run as a plug-in and use the API interface provided by the Pyautocad library to establish a connection with AutoCAD. The functional logic of the plug-in is: by analyzing the objects in the drawing, distinguishing elements such as lines and text, and realizing the function of exporting the original drawing, line sub-drawing, and text sub-drawing from the CAD drawing.

[0021] 1.3) Plug-in installation and testing: Install the written plug-in into the CAD software, conduct sufficient testing and debugging to ensure that the plug-in can run normally and achieve the expected functions. Specifically: open the CAD drawing file to be processed through the plug-in; loop through all graphic entity objects in the CAD drawing, filter out different elements such as text and lines according to the object's properties (text properties, text content, etc.), and store them separately.

[0022] 1.4) Graphics export: Determine and set the resolution, size and other parameters of the image to be exported to ensure that the exported images have the same specifications; use Pyautocad's image export function to export the original image, text sub-image, and line sub-image respectively.

[0023] After testing, the plug-in can separate lines, text and other elements in drawings, and can run normally and meet the needs. Based on the automated plug-in, a large number of samples for training the UNet model can be quickly generated from the stock data, namely the original image, line sub-image and text sub-image, as key data for training the image and text separation algorithm model. And there is no need for manual labeling, which greatly improves work efficiency.

[0024] 2) Data training: The original image, line sub-image and text sub-image derived from data preparation are used as training data sets for data training. The original image is used as the input data of the model, while the line sub-image and text sub-image are used as the corresponding model output data, and are trained using the UNet network. By constructing a single-channel input and two-channel output UNet model for training, a universal image-text separation model is obtained. The following is the specific training process: 2.1) Data processing 2.11) Convert the original image to grayscale, retaining only the brightness information to simplify the data complexity; divide the pixel value in the grayscale image by 255 and normalize the data to between 0 and 1 to speed up the training process; 2.12) Increase data diversity and improve model generalization ability by rotating, flipping, scaling, etc.

[0025] 2.2) Building the UNet model 2.21) Model Architecture Encoder: It consists of multiple convolutional layers and pooling layers, which gradually reduce the spatial dimension of the image while increasing the depth of the feature map, enabling the model to capture higher-level image features; Decoder: It consists of multiple convolutional layers and upsampling layers, which gradually restore the spatial dimensions of the image while reducing the depth of the feature map, which helps to construct image details more accurately; Skip connection: Fuse the feature maps in the encoder with those in the decoder to preserve more spatial information.

[0026] 2.22) Loss function calculation: Select a suitable loss function (cross entropy loss) and calculate the difference between the predicted segmentation map and the true segmentation map.

[0027] 2.3) Training process 2.31) The processed original image is used as the model input, and through continuous convolution pooling in the encoder, the channel is doubled each time to obtain several intermediate features; 2.32) Then decode and restore the image spatial resolution through continuous transposed convolution resize (image resizing) function, halving the channel each time to obtain the intermediate features; 2.33) The intermediate features at the same position between the encoder and decoder are fused through a span connection and finally mapped to two-channel outputs, which respectively represent the predicted line sub-image and text sub-image information; 2.34) Compare the output segmentation map of the model with the corresponding true segmentation map and calculate the loss function. Calculate the gradient of the model according to the back-propagation algorithm and update the model parameters according to the gradient information to reduce the loss value.

[0028] 2.35) Repeat the above steps and perform iterative training to finally obtain the general image-text separation model for secondary drawings of power system.

[0029] 3) Use the general text-image separation model of power system secondary drawings to segment the drawings to obtain text sub-drawings and line sub-drawings, providing a basis for subsequent digital conversion of drawings.

[0030] The present invention proposes a method for separating text and image from secondary drawings of power systems, aiming to obtain a large number of sample drawings by writing a CAD plug-in, and obtain a general text and image separation model by inputting it into a UNet network for training, thereby improving the accuracy and efficiency of drawing information processing and providing basic support for the digital and intelligent development of power systems.

[0031] The above description is only a preferred specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can make equivalent replacements or changes according to the technical scheme and inventive concept of the present invention within the technical scope disclosed by the present invention, which should be covered by the protection scope of the present invention.

Claims

1. A method for separating text and image from secondary drawings of a power system, characterized in that: The following steps are involved: 1) Data preparation: Based on CAD drawings of the same style, by writing an automated CAD plug-in, the drawings can be exported with the same resolution and size to include the original drawing, line sub-drawing, and text sub-drawing. 2) Data training: The original image, line sub-image and text sub-image derived from data preparation are used as training data sets; the original image is used as the input data of the model, while the line sub-image and text sub-image are used as the corresponding model output data. The UNet network is used for training to obtain a universal image-text separation model. 3) Use the image-text separation model to segment the drawing to obtain text sub-images and line sub-images.

2. A method for separating text and image from secondary drawings of a power system according to claim 1, characterized in that: An automated CAD plug-in is written based on the Pyautocad library to filter out the text part in the original drawing, obtain pure text sub-images and line sub-images, and then export them into bitmaps to obtain the original image, text sub-images and line sub-images.

3. A method for separating text and image from secondary drawings of a power system according to claim 2, characterized in that: Write automated CAD plug-ins based on the Pyautocad library, including: 1.1) Environment preparation: Install Python and Pyautocad libraries, and ensure that AutoCAD supports ActiveX Automation programs to control AutoCAD; 1.2) Write a plug-in: Write a Python script that will run as a plug-in and use the API interface provided by the Pyautocad library to establish a connection with AutoCAD; The functional logic of the plugin is: distinguish lines and texts by analyzing objects in the drawing; 1.3) Plug-in installation and testing: Install the written plug-in into the CAD software for testing and debugging; specifically: open the CAD drawing file to be processed through the plug-in; loop through all graphic entity objects in the CAD drawing, filter out text and line elements according to the attributes of the objects, and store them separately; 1.4) Graphics export: Determine and set the parameters of the image to be exported, ensuring that the exported images have the same specifications; use Pyautocad's image export function to export the original image, text sub-image, and line sub-image respectively.

4. A method for separating text and image from secondary drawings of a power system according to claim 3, characterized in that: Step 2) includes: 2.1) Data processing 2.11) Convert the original image to grayscale and retain the brightness information; divide the pixel value in the grayscale image by 255 and normalize the data to between 0 and 1; 2.12) Increase data diversity through rotation, flipping, and scaling methods; 2.2) Building the UNet model 2.21) The model architecture includes an encoder and a decoder, It also includes skip connections to fuse feature maps from the encoder with those from the decoder; 2.22) The loss function selects the cross entropy loss function; 2.3) Training process 2.31) The processed original image is used as the model input, and through continuous convolution pooling in the encoder, the channel is doubled each time to obtain several intermediate features; 2.32) Then decode and restore the image spatial resolution through continuous transposed convolution resize function, halving the channel each time to obtain the intermediate features; 2.33) The intermediate features at the same position between the encoder and decoder are fused through a span connection and finally mapped to two-channel outputs, which respectively represent the predicted line sub-image and text sub-image information; 2.34) Compare the output segmentation map of the model with the corresponding true segmentation map and calculate the loss function; calculate the gradient of the model according to the back propagation algorithm and update the model parameters according to the gradient information; 2.35) Repeat the above steps and perform iterative training to finally obtain the general image-text separation model for secondary drawings of power system.

Citation Information

Patent Citations

  • Electrical construction drawing identification method and device

    CN110728260A

  • Automatic drawing method and device for secondary circuit of power system and electronic equipment

    CN116776404A

  • Automatic identification method and terminal for electric drawing of hydraulic power plant

    CN117912023A

  • U-Net-based electrical secondary drawing character information identification method and system

    CN117975464A