An electrical drawing recognition method and system

By employing a lightweight YOLOv8-nano model and OCR engine in electrical drawing recognition, and automating the processing of electrical drawings based on CPU, the high cost and low efficiency of electrical drawing recognition on low- and mid-range devices are solved, structured data output is achieved, and digital applications of electrical systems are supported.

CN122176744APending Publication Date: 2026-06-09青岛中车四方轨道车辆有限公司

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
青岛中车四方轨道车辆有限公司
Filing Date
2026-03-19
Publication Date
2026-06-09

AI Technical Summary

Technical Problem

Existing electrical drawing recognition technologies rely on high-performance hardware, which is costly and has poor adaptability. The recognition process is fragmented, the structured output capability is weak, the model is not lightweight enough, and the data preparation efficiency is low, making it difficult to apply efficiently on low- and mid-range devices.

Method used

Employing a lightweight YOLOv8-nano model and OCR engine, running on a CPU, it automates the processing of electrical drawing data and outputs structured data, including component types, bounding boxes, key areas, and text information.

Benefits of technology

It enables automated recognition of electrical drawings on low- to mid-range devices without GPU dependency, improving recognition efficiency and accuracy. The output of structured data facilitates the digital application of electrical systems and is easy to expand and maintain.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122176744A_ABST
    Figure CN122176744A_ABST
Patent Text Reader

Abstract

This invention relates to an electrical drawing recognition method and system. The recognition method includes: acquiring multiple images corresponding to the electrical drawing and generating a dataset directory structure that conforms to the training requirements of the YOLO model; loading the YOLO model and training the classifier model and recognizer model for each component, and saving the training results; initializing the classifier model, recognizer model, and OCR engine; loading the trained classifier model and performing YOLO object detection on the input image, outputting the component type, bounding box coordinates, and confidence score; loading the trained recognizer model and inputting the corresponding component region image to detect key regions within the component; the OCR engine extracting textual information from the key regions within the component image and the rule engine integrating the fields corresponding to the key regions within the component to generate structured data after recognition; and outputting the recognition results for all components. This invention can automatically and accurately recognize component information in electrical drawings.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of electrical drawing recognition technology, specifically to an electrical drawing recognition method and system. Background Technology

[0002] Electrical drawings are core documents for the design, operation, maintenance, and renovation of electrical systems. They contain accurate extraction of information such as component types (e.g., switches, relays, indicator lights), component codes, component names, pin numbers, connection relationships, and wire numbers, which are crucial for the digital and intelligent management of electrical systems.

[0003] In the existing technology, electrical drawing recognition mainly has the following problems: (1) Reliance on high-performance hardware: The mainstream electrical drawing recognition scheme is based on deep learning models accelerated by GPU (Graphics Processing Unit), which requires high-memory graphics cards. Low-end computers (containing only CPU) cannot be deployed, resulting in high cost and poor adaptability; (2) Fragmented recognition process: Component detection, text extraction, structured integration and other links are independent of each other, lacking a unified scheduling architecture. Manual intervention is required for multiple links, which is inefficient and prone to errors; (3) Weak structured output capability: The existing recognition results are mostly non-standardized text or image annotations, which cannot directly output structured data containing component codes, pin numbers, and connection relationships, making it difficult to connect with subsequent electrical system analysis, modeling and other applications; Insufficient model lightweighting: Mainstream object detection models (such as YOLOv8-large) have a large number of parameters, slow CPU inference speed, and the OCR engine is not optimized for the CPU environment, further reducing recognition efficiency; Low data preparation efficiency: Electrical drawings in PDF format need to be manually converted into images and the training / validation sets need to be segmented. The labeled data cannot be directly adapted to the YOLO model training process, resulting in a long model iteration cycle. Summary of the Invention

[0004] In response to the problems pointed out in the background art, one of the objectives of this invention is to provide an electrical drawing recognition method based on the YOLO model and OCR recognition, which runs entirely on the CPU and does not rely on the GPU, resulting in low hardware investment costs and wide compatibility with low- and mid-range computing devices; it realizes the automated recognition of images corresponding to electrical drawings, and outputs key areas inside the components identified in the electrical drawings, thus meeting the needs of digital applications of electrical systems.

[0005] To address the aforementioned technical problems, the present invention proposes the following technical solution: This application provides a method for recognizing electrical drawings, including: Data preparation and model training phase: The system acquires multiple images corresponding to electrical drawings, automatically segments them into training and validation sets, and generates a dataset directory structure that meets the requirements for YOLO model training. Load the YOLO model, train the classifier model and the recognizer model of the component respectively, and save the training after completion. The classifier model is used to detect the component type and location in the image, and the recognizer model is used to detect key regions inside the component. Electrical drawing reasoning stage: Initialize the classifier model, recognizer model, and OCR engine, and configure the CPU inference parameters, which include specifying the model to perform inference tasks on the CPU, controlling the OCR engine module to disable the GPU, and the number of concurrent worker threads used in the OCR processing. Load the pre-trained classifier model, perform YOLO object detection on the input image, and output the component type, bounding box coordinates, and confidence score; Based on the classification results output by the classifier model, crop the corresponding component region image from the image, load the trained recognizer model, input the corresponding component region image, and detect the key regions inside the component. The OCR engine extracts text information from key areas inside the component's image and, combined with preset rules, integrates the fields corresponding to the key areas inside the component to generate structured data after recognition. Output the recognition results for all components.

[0006] In some embodiments of this application, multiple images corresponding to electrical drawings are obtained, specifically as follows: When the electrical drawings are in PDF format, PyMuPDF is used to convert each page of the PDF file into multiple images, and the resolution of the corresponding images is adjusted to suit CPU inference.

[0007] In some embodiments of this application, the YOLO model is selected as the YOLOv8-nano base model, and training and inference parameters are configured for the YOLO model. The training inference parameters include the size of the input image, specifying that the model runs on the CPU, disabling half-precision floating-point calculations, setting the confidence threshold, setting the IoU threshold for non-maximum suppression, and enabling the verbose output mode.

[0008] In some embodiments of this application, the CPU inference parameters include specifying that the model performs inference tasks on the CPU, controlling the OCR engine module to disable the GPU, and the number of concurrent worker threads used in the OCR processing.

[0009] In some embodiments of this application, during the electrical drawing inference stage, when outputting component type, bounding box coordinates, and confidence level, results with confidence levels lower than the confidence level threshold are filtered out.

[0010] In some embodiments of this application, the key areas inside the component include the component name, component code, pin number, connection relationship, and wire number.

[0011] In some embodiments of this application, the electrical drawing recognition method further includes configuring OCR engine parameters, which include recognizing only Simplified Chinese and English, a confidence threshold for the OCR recognition result, the number of concurrent worker threads used in the OCR processing, disabling the GPU, and enabling a detailed output mode. When extracting text information, filter out recognition results with a confidence level lower than the confidence threshold of the OCR recognition result.

[0012] In some embodiments of this application, redundant fields are removed from the identification results of all integrated components, and the results are output as a standardized JSON format file.

[0013] Compared with the prior art, the electrical drawing recognition method involved in this application has the following beneficial effects and advantages: (1) The entire process is based on CPU, with no GPU / video memory dependency, adaptable to low-end and mid-range devices, low deployment cost, and strong cross-platform compatibility; (2) Based on the lightweight YOLO model and OCR recognition, the entire process from electrical drawings to result output is automated without human intervention, and the model training cycle is short, which improves recognition efficiency; (3) Output identification data containing key areas of components, which can be used for downstream applications such as digital modeling and operation and maintenance analysis of electrical systems as needed; (4) When adding a new component type, only the dataset needs to be added and the corresponding recognizer model needs to be trained. There is no need to modify the core process, making it easy to expand and maintain.

[0014] This application also relates to an electrical drawing recognition system, comprising: The data preparation module is used to acquire multiple images corresponding to electrical drawings, automatically segment them into training and validation sets, and generate a dataset directory structure that meets the requirements for YOLO model training. The model training module loads the YOLO model and trains the classifier and recognizer models for each component. After training, the module is saved. The classifier model detects the component type and location in the image, while the recognizer model detects key regions within the components. The detection and recognition module includes: The classifier submodule is used to load a pre-trained classifier model, perform YOLO object detection on the input image, and output component type, bounding box coordinates, and confidence score. The recognizer submodule, based on the classification results output by the classifier model, crops the corresponding component region image in the image, loads the trained recognizer model, inputs the corresponding component region image, and detects the key regions inside the component. The OCR engine submodule extracts text information from key areas within the component region image and, in conjunction with preset rules, integrates the fields corresponding to the key areas within the component to generate the recognized structured data. The scheduler module initializes the classifier submodule, recognizer submodule, and OCR engine submodule, controls the inference process of a single image or batch of images, integrates the output results of the classifier model and the recognizer model, and filters low-confidence data. The results output module is used to output the recognition results of all components.

[0015] In some embodiments of this application, the result output module removes redundant fields from the identification results of all integrated components and outputs them as a standardized JSON format file. Other features and advantages of the present invention will become clearer after reading the detailed embodiments of the invention in conjunction with the accompanying drawings. Attached Figure Description

[0016] 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 of the present invention or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0017] Figure 1 This is a flowchart of the electrical drawing recognition method of the present invention; Figure 2 To output the identification result of a disconnector switch assembly using the electrical drawing identification method of the present invention. Detailed Implementation

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

[0019] In the description of this application, it should be understood that the terms "center", "upper", "lower", "front", "rear", "left", "right", "vertical", "horizontal", "top", "bottom", "inner", "outer", etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are only for the convenience of describing this application and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on this application.

[0020] The terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this application, unless otherwise stated, "a plurality of" means two or more.

[0021] In the description of this application, it should be noted that, unless otherwise expressly specified and limited, the terms "installation," "connection," and "linking" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection between two components. Those skilled in the art can understand the specific meaning of the above terms in this application based on the specific circumstances.

[0022] In this invention, unless otherwise explicitly specified and limited, "above" or "below" the second feature can include direct contact between the first and second features, or contact between the first and second features through another feature between them. Furthermore, "above," "over," and "on top" of the second feature includes the first feature directly above or diagonally above the second feature, or simply indicates that the first feature is at a higher horizontal level than the second feature. "Below," "below," and "under" the second feature includes the first feature directly below or diagonally below the second feature, or simply indicates that the first feature is at a lower horizontal level than the second feature.

[0023] The following disclosure provides many different embodiments or examples for implementing various structures of the invention. To simplify the disclosure, specific examples of components and arrangements are described below. These are merely examples and are not intended to limit the invention. Furthermore, reference numerals and / or letters may be repeated in different examples; such repetition is for simplification and clarity and does not in itself indicate a relationship between the various embodiments and / or arrangements discussed. In addition, examples of various specific processes and materials are provided in this invention, but those skilled in the art will recognize the application of other processes and / or the use of other materials.

[0024] To efficiently identify electrical drawings for use in the digital and intelligent management of electrical systems, a lightweight, GPU-independent, end-to-end automated method and system for electrical drawing identification is provided.

[0025] The electrical drawing recognition method involved in this application relies on an electrical drawing recognition system for implementation, as described below in conjunction with the electrical drawing recognition system and Figure 1 This describes a method for recognizing electrical drawings.

[0026] The electrical drawing recognition method includes a data preparation and model training phase and an electrical drawing inference phase.

[0027] The data preparation and model training phase involves two parts: data preparation and model training. Data preparation involves the following S1, and model training involves the following S2.

[0028] S1: Obtain multiple images corresponding to electrical drawings, automatically segment the multiple images and corresponding label files into training and validation sets, and generate a dataset directory structure that meets the requirements for YOLO model training.

[0029] The process of S1 is implemented by the data preparation module (not shown) in the electrical drawing recognition system.

[0030] In some embodiments of this application, electrical drawings may be PDF files or images in JPG / PNG / BMP formats.

[0031] The electrical drawing recognition method in this application is based on image processing. Therefore, if the electrical drawing is a PDF file, it is necessary to convert the PDF file page by page into multiple images. For example, PyMuPDF can be used to convert the PDF file page by page into multiple images. In this process, the resolution of the corresponding images needs to be adjusted to adapt to CPU inference.

[0032] The dataset directory structure required for YOLO model training refers to the data organization required when training or inferring using the YOLO (You Only Look Once) series of object detection models. This dataset directory structure helps the model correctly read images and their corresponding annotation information.

[0033] The dataset directory structure includes an image directory and a label directory. The image directory contains training set images and validation set images, while the label directory contains label files that correspond one-to-one with the training set images and label files that correspond one-to-one with the validation set images, forming the YAML format configuration file required for YOLO model training.

[0034] The ratio of the training set to the validation set can be 8:2.

[0035] S2: Load the YOLO model, train the classifier and recognizer models of the components respectively, and save after training.

[0036] The process of S2 is implemented by the model training module (not shown) in the electrical drawing recognition system.

[0037] In some embodiments of this application, the YOLO model selected is the YOLOv8-nano base model. This base model features a lightweight structure, high inference speed, support for multiple tasks (e.g., object detection, instance segmentation, image classification), and CPU optimization, making it suitable for scenarios that run on the CPU without GPU acceleration.

[0038] To adapt to CPU operation, the training and inference parameters for the YOLOv8-nano base model are configured, including: the input image size imgsz, specifying that the model runs on the CPU (device='cpu'), disabling half-precision floating-point calculation (half=False), setting the confidence threshold (conf=0.05), setting the IoU threshold for non-maximum suppression (iou=0.45), and enabling verbose output mode (verbose=False).

[0039] The classifier model is used to detect the type of components (e.g., disconnect switches, relays, indicator lights) and their location in the image, while the recognizer model is used to detect key areas inside the components (e.g., component code, component name, pin number, connection relationship, wire number, etc.).

[0040] Save the trained classifier and recognizer models to the specified path so that they can be loaded during the electrical drawing inference stage.

[0041] The electrical drawing reasoning stage involves model initialization, detection and recognition (including component type detection, detailed component recognition, OCR text extraction and engine integration), and result output.

[0042] Model initialization involves S3, detection and recognition involve S4 to S6 (component type detection involves S4, detailed component recognition involves S5, OCR text extraction and rule engine integration involve S6), and result output involves S7.

[0043] S3: Initialize the classifier model, recognizer model, and OCR engine, and configure the CPU inference parameters.

[0044] In some embodiments of this application, a scheduler module (not shown) is provided in the electrical drawing recognition system.

[0045] The scheduler module, as the core calling unit, is used to implement the above initialization, control the inference process of single images / batch images, integrate the output results of classifier models and recognizer models, and filter low-confidence data.

[0046] CPU inference parameters include specifying that the model performs inference tasks on the CPU (YOLO_DEVICE='cpu'), controlling the OCR engine module to disable the GPU (OCR_GPU=False), and the number of concurrent worker threads used during OCR processing (OCR_WORKERS=1). These parameter combinations ensure that the YOLOv8-Nano base model can run efficiently on ordinary computers.

[0047] S4: Load the trained classifier model, perform YOLO object detection on the input image, and output the component type, bounding box coordinates, and confidence score.

[0048] In some embodiments of this application, a classifier submodule (not shown) is provided in the electrical drawing recognition system to perform the above-described S4.

[0049] The bounding box coordinates represent the location of the component type.

[0050] In some embodiments of this application, to ensure accurate output results, results with confidence levels below a confidence threshold are filtered when outputting component type, bounding box coordinates, and confidence level.

[0051] S5: Based on the classification results output by the classifier model, crop the corresponding component region image from the image, load the trained recognizer model, input the corresponding component region image, and detect the key regions inside the component.

[0052] In some embodiments of this application, an identifier submodule (not shown) is provided in the electrical drawing recognition system to perform the above-described S5.

[0053] In some embodiments of this application, in order to accurately identify key regions inside the component, the corresponding component region image is cropped from the image based on the classification result output by the classifier to obtain a small-sized image containing the key regions inside the component.

[0054] S6: The OCR engine extracts text information from key areas inside the component's image and, combined with preset rules, integrates the fields corresponding to the key areas inside the component to generate structured data after recognition.

[0055] In some embodiments of this application, an OCR engine submodule (not shown) is provided in the electrical drawing recognition system to perform the above-described S6.

[0056] The OCR engine submodule involves extracting text information and integrating a rule engine. This OCR engine submodule is based on EasyOCR and adapted to the CPU.

[0057] In some embodiments of this application, OCR engine parameters can be configured for the OCR engine submodule, which is based on EasyOCR and adapted to the CPU.

[0058] The OCR engine parameters include recognizing only Simplified Chinese and English (lang=['ch_sim','en']), the confidence threshold for OCR recognition results (confidence_threshold=0.3), the number of concurrent worker threads used in OCR processing (workers=1), disabling GPU (gpu=False), and enabling verbose output mode (verbose=False).

[0059] The OCR engine extracts Chinese text information (e.g., Chinese and English text information) from key areas inside the cropped component region image and filters out recognition results with confidence scores below the confidence threshold.

[0060] The extracted text information, combined with preset rules, is integrated by the engine to include data such as component name, component code, pin number, connection relationship, and wire number. This allows the extracted text information to be mapped to fields corresponding to key areas within the component (e.g., pin, connection, wire_num), generating structured data after recognition.

[0061] The scheduler module is used to initialize the classifier submodule, the recognizer submodule, and the OCR engine submodule.

[0062] S7: Output the recognition results of all components.

[0063] The process of S7 is implemented by the result output module (not shown) in the electrical drawing recognition system.

[0064] For the recognition results of all integrated components, redundant fields (such as bounding boxes and confidence scores) are removed, and the results are output as a standardized JSON format file.

[0065] This standardized JSON format file includes component code, component name, pin number, connection relationship and wire number. The standardized structured output data can be directly connected to downstream applications such as digital modeling and operation and maintenance analysis of electrical systems, which facilitates digital use.

[0066] refer to Figure 2 The example shows a standardized JSON format file as the final output.

[0067] The electrical drawing recognition system involved in this application adopts a modular architecture design. When adding a new component type, only the dataset needs to be added and the corresponding recognizer model needs to be trained. There is no need to modify the core process, which is easy to expand and maintain. The CPU adaptation parameters of the YOLOv8 lightweight model and the OCR engine are optimized to balance recognition accuracy and inference speed. The entire process is based on CPU and has no GPU / video memory dependency, making it compatible with low-end and mid-range computing devices. The modular, end-to-end recognition architecture realizes a fully automated process from PDF / image input to structured JSON output without manual intervention, avoiding process fragmentation and improving recognition efficiency and accuracy.

[0068] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for recognizing electrical drawings, characterized in that, include: Data preparation and model training phase: Obtain multiple images corresponding to electrical drawings, automatically segment the multiple images and their corresponding label files into training and validation sets, and generate a dataset directory structure that meets the requirements for YOLO model training. Load the YOLO model, train the classifier model and the recognizer model of the component respectively, and save the training after completion. The classifier model is used to detect the component type and location in the image, and the recognizer model is used to detect key regions inside the component. Electrical drawing reasoning stage: Initialize the classifier model, recognizer model, and OCR engine, and configure the CPU inference parameters, which include specifying the model to perform inference tasks on the CPU, controlling the OCR engine module to disable the GPU, and the number of concurrent worker threads used in the OCR processing. Load the pre-trained classifier model, perform YOLO object detection on the input image, and output the component type, bounding box coordinates, and confidence score; Based on the classification results output by the classifier model, crop the corresponding component region image from the image, load the trained recognizer model, input the corresponding component region image, and detect the key regions inside the component. The OCR engine extracts text information from key areas inside the component's image and, combined with preset rules, integrates the fields corresponding to the key areas inside the component to generate structured data after recognition. Output the recognition results for all components.

2. The electrical drawing recognition method according to claim 1, characterized in that, Obtain the multiple images corresponding to the electrical drawings, specifically: When the electrical drawings are in PDF format, PyMuPDF is used to convert each page of the PDF file into multiple images, and the resolution of the corresponding images is adjusted to suit CPU inference.

3. The electrical drawing recognition method according to claim 1, characterized in that, The YOLO model selected is the YOLOv8-nano base model, and training and inference parameters are configured for the YOLO model. The training inference parameters include the size of the input image, specifying that the model runs on the CPU, disabling half-precision floating-point calculations, setting the confidence threshold, setting the IoU threshold for non-maximum suppression, and enabling the verbose output mode.

4. The electrical drawing recognition method according to claim 1, characterized in that, During the electrical drawing reasoning phase, when outputting component type, bounding box coordinates, and confidence level, results with confidence levels below the confidence threshold are filtered out.

5. The electrical drawing recognition method according to claim 1, characterized in that, The key areas inside the component include the component name, component code, pin number, connection relationship, and wire number.

6. The electrical drawing recognition method according to claim 1, characterized in that, The electrical drawing recognition method also includes configuring OCR engine parameters, which include recognizing only Simplified Chinese and English, the confidence threshold of the OCR recognition result, the number of concurrent worker threads used in the OCR processing, disabling the GPU, and enabling detailed output mode. When extracting text information, filter out recognition results with a confidence level lower than the confidence threshold of the OCR recognition result.

7. The electrical drawing recognition method according to claim 1, characterized in that, For the identification results of all integrated components, redundant fields are removed and the output is a standardized JSON format file.

8. An electrical drawing recognition system, characterized in that, include: The data preparation module is used to acquire multiple images corresponding to electrical drawings, automatically divide the multiple images and corresponding label files into training and validation sets, and generate a dataset directory structure that meets the requirements for YOLO model training. The model training module loads the YOLO model and trains the classifier and recognizer models for each component. After training, the module is saved. The classifier model detects the component type and location in the image, while the recognizer model detects key regions within the components. The detection and recognition module includes: The classifier submodule is used to load a pre-trained classifier model, perform YOLO object detection on the input image, and output component type, bounding box coordinates, and confidence score. The recognizer submodule, based on the classification results output by the classifier model, crops the corresponding component region image in the image, loads the trained recognizer model, inputs the corresponding component region image, and detects the key regions inside the component. The OCR engine submodule extracts text information from key areas inside the component region image. The engine integrates the fields corresponding to the key areas inside the component to generate the recognized structured data. The scheduler module initializes the classifier submodule, recognizer submodule, and OCR engine submodule, controls the inference process of a single image or batch of images, integrates the output results of the classifier model and the recognizer model, and filters low-confidence data. The results output module is used to output the recognition results of all components.

9. The electrical drawing recognition system according to claim 8, characterized in that, The result output module removes redundant fields from the recognition results of all integrated components and outputs them as a standardized JSON format file.