Substation wiring diagram detection method based on YOLOv6 and traditional image processing technology
By combining YOLOv6 with traditional image processing technology, the topological relationships of electrical components in the wiring diagram of power grid stations are automatically identified, solving the problems of low detection accuracy and difficulty in topological relationship identification in existing technologies, and achieving efficient and accurate wiring diagram detection.
Patent Information
- Application Number
- CN202211029640.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-25
- Publication Date
- 2025-11-11
- Estimated Expiration
- 2042-08-25
AI Technical Summary
Existing methods for identifying power grid substation wiring diagrams have low detection accuracy and cannot effectively identify topological relationships, increasing safety risks and labor costs.
This method employs a combination of YOLOv6 and traditional image processing techniques, integrating BD and CRNN algorithms to recognize text. YOLOv6 is used to detect primitives, and OpenCV is used to process the image, identifying primitive angles and connecting line topological relationships to generate formatted text.
It achieves high-quality and high-efficiency topology relationship detection of power grid station wiring diagrams, improving the accuracy of element recognition and topology relationship recognition.
Smart Images

Figure CN115376155B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of plant wiring diagram detection technology, specifically a plant wiring diagram detection method based on YOLOv6 and traditional image processing technology. Background Technology
[0002] Substation wiring diagrams, as critical data in power systems, form the foundation of power system dispatching. They are widely used in power systems, both from the perspective of power production management and the uninterrupted nature of power production and consumption, for applications such as power flow calculation, short-circuit current calculation, reliability analysis, and grid dispatch automation. Traditionally, the drawing and maintenance of substation wiring diagrams rely primarily on the experience of power dispatchers. Due to the numerous components and complex wiring in substation wiring diagrams, this approach not only increases the risk of power grid safety incidents but also incurs high labor costs for maintenance.
[0003] To address this issue, current methods for identifying power grid and substation wiring diagrams employ the Faster R-CNN object detection algorithm. However, this algorithm has relatively low detection accuracy, and existing methods for identifying power grid and substation wiring diagrams are inconsistent in their topological relationships, failing to accurately identify the topological relationships between graphic elements and connecting lines. The detection of connecting lines is limited to the location identification stage. Summary of the Invention
[0004] (a) Technical problems to be solved
[0005] To address the shortcomings of existing technologies, this invention provides a method for detecting plant wiring diagrams based on YOLOv6 and traditional image processing techniques, thus solving the problems mentioned in the background.
[0006] (II) Technical Solution
[0007] To achieve the above objectives, the present invention provides the following technical solution: a method for detecting wiring diagrams of power plants based on YOLOv6 and traditional image processing technology, comprising the following steps:
[0008] S1. Use the BD algorithm + CRNN algorithm to recognize the text in the original power grid and substation wiring diagram. The position of the text is represented by the center position of the rectangle. Use OpenCV to manipulate the image and delete the text.
[0009] S2. Use the YOLOv6 algorithm to detect primitives;
[0010] S3. Classify the angles of graphic elements;
[0011] S4. Connector topology detection;
[0012] S5. Find the nearest connecting line based on the direction indicated by the angle of the graphic element; then determine the position of the nearest endpoint of the connecting line based on the center position of the text rectangle, thereby completing the matching of the connecting line, text, and graphic element;
[0013] S6. Generate formatted text based on the information from the above process.
[0014] Preferably, the CRNN model in S1 is a pre-trained model that can generate text and text location without local training.
[0015] Preferably, S2 specifically comprises:
[0016] S21. Divide the existing station wiring diagram dataset into training and test sets;
[0017] S22. Use the Labelme annotation tool to annotate the elements on the original station wiring diagram;
[0018] S23. Train the YOLOv6 model on the divided training set. To address the problem of circuit diagram images being too large and primitive targets being too small, adopt an image block strategy for training and detection. When dividing the blocks, set overlapping areas to avoid primitive targets being truncated. Finally, use the NMS algorithm to merge them.
[0019] S24. Test the YOLOv6 model trained on the training set on the test set, and save the weights of the model with the best performance.
[0020] S25. When using the model for testing later, save the position of the primitive rectangle. The position of the primitive is represented by the center of the rectangle.
[0021] Preferably, step S3 specifically involves: cropping the primitives detected in the above steps using OpenVC and saving them as image format; then rotating all primitives by three angles (90°, 180°, 270°) or one angle (90°, symmetrical primitives have only two angles) and saving them as the original dataset; dividing the dataset into training and testing sets and using a typical classification neural network for angle classification; considering the complexity of the data, a shallower ResNet12 network is used here.
[0022] Preferably, S4 specifically comprises:
[0023] S41. Use OpenCV to manipulate the positions of the primitives and text obtained in the above steps, and crop all the images and text so that only the connecting lines remain in the wiring diagram.
[0024] S42. Process the station wiring diagram image using filtering and binarization algorithms in OpenCV; then use template matching algorithms to detect the connecting lines. The specific steps are as follows:
[0025] S421. The template has various styles, including "I", "T" and "+" shaped templates;
[0026] S422. For points that are horizontally or vertically identical, connect the two closest points by calculating their coordinate distance.
[0027] S423. Record the coordinates of the two endpoints of the connecting line.
[0028] Preferably, the formatted text information in S6 includes primitive category, primitive position, text content, text position, connector endpoint position, and topological relationship between connector and primitive and text, etc.
[0029] (III) Beneficial Effects
[0030] This invention provides a method for detecting wiring diagrams in power plants based on YOLOv6 and traditional image processing techniques, which has the following beneficial effects:
[0031] (1) This invention utilizes a combination of computer image processing technology and deep learning technology to automatically obtain the topological relationships of electrical components in the wiring diagram of power plants. By preprocessing the scalar format wiring diagram of the power system, high-quality and high-efficiency topological relationship detection is achieved.
[0032] (2) In addition to improving the accuracy of identifying elements in the wiring diagram of power grid stations, the present invention can also identify the angle of the elements, further improving the accuracy of the topological relationship between the connecting lines and the elements as well as the text labeled for the elements. Attached Figure Description
[0033] Figure 1 This is a flowchart;
[0034] Figure 2 This is the original image;
[0035] Figure 3 This is a diagram illustrating the text detection results;
[0036] Figure 4 This is a schematic diagram showing the detected elements.
[0037] Figure 5 This is a schematic diagram for testing the connecting wires. Detailed Implementation
[0038] 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.
[0039] like Figure 1 As shown, this invention provides a technical solution: a method for detecting wiring diagrams in power plants based on YOLOv6 and traditional image processing technology, comprising the following steps:
[0040] S1. The BD algorithm + CRNN algorithm is used to recognize the text in the original power grid and substation wiring diagram. The CRNN model is a pre-trained model that can generate text and text positions without local training. The text position is represented by the center position of a rectangle. OpenCV is used to manipulate the image and remove text. (Original image as shown) Figure 2 As shown, text detection is as follows Figure 3 (As shown)
[0041] S2. Detect primitives using the YOLOv6 algorithm.
[0042] S21. Divide the existing station wiring diagram dataset into training and test sets;
[0043] S22. Use the Labelme annotation tool to annotate the elements on the original station wiring diagram;
[0044] S23. Train the YOLOv6 model on the divided training set. To address the problem of circuit diagram images being too large and primitive targets being too small, adopt an image block strategy for training and detection. When dividing the blocks, set overlapping areas to avoid primitive targets being truncated. Finally, use the NMS algorithm to merge them.
[0045] S24. Test the YOLOv6 model trained on the training set on the test set, and save the weights of the model with the best performance.
[0046] S25. When using the model for subsequent testing, save the position of the element's bounding box. The position of the element is represented by the center of the bounding box; (after the element has been detected, if...) Figure 4 (As shown)
[0047] S3. Classify the angles of graphic elements.
[0048] The primitives detected through the above steps are cropped using OpenVC and saved as images. Then, all primitives are rotated by three angles (90°, 180°, 270°) or one angle (90°, symmetrical primitives have only two angles) and saved as the original dataset. The dataset is then divided into training and testing sets, and angle classification is performed using a typical classification neural network. Considering the complexity of the data, a shallower ResNet12 network is used here.
[0049] S4. Connector Topology Detection
[0050] S41. Using OpenCV, manipulate the primitive and text positions obtained in the above steps to crop all images and text, leaving only connecting lines in the wiring diagram; (connecting line detection is as follows) Figure 5 (As shown)
[0051] S42. Process the station wiring diagram image using filtering and binarization algorithms in OpenCV; then use template matching algorithms to detect the connecting lines. The specific steps are as follows:
[0052] S421. The template has various styles, including "I", "T" and "+" shaped templates;
[0053] S422. For points that are horizontally or vertically identical, connect the two closest points by calculating their coordinate distance.
[0054] S423. Record the connecting line using the coordinates of its two endpoints;
[0055] S5. Find the nearest connecting line based on the direction indicated by the angle of the graphic element; then determine the position of the nearest endpoint of the connecting line based on the center position of the text rectangle, thereby completing the matching of the connecting line, text, and graphic element;
[0056] S6. Generate formatted text based on the information from the above process. The formatted text information includes the primitive category, the primitive position, the text content, the text position, the endpoint positions of the connectors, and the topological relationship between the connectors and the primitives and text, etc.
[0057] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus.
[0058] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.
Claims
1. A method for detecting wiring diagrams in power plants based on YOLOv6 and traditional image processing techniques, characterized in that, Includes the following steps: S1. Use the BD algorithm + CRNN algorithm to recognize the text in the original power grid and substation wiring diagram. The position of the text is represented by the center position of the rectangle. Use OpenCV to manipulate the image and delete the text. S2. Use the YOLOv6 algorithm to detect primitives, specifically: S21. Divide the existing station wiring diagram dataset into training and test sets; S22. Use the Labelme annotation tool to annotate the elements on the original station wiring diagram; S23. Train the YOLOv6 model on the divided training set. To address the problem of circuit diagram images being too large and primitive targets being too small, adopt an image block strategy for training and detection. When dividing the blocks, set overlapping areas to avoid primitive targets being truncated. Finally, use the NMS algorithm to merge them. S24. Test the YOLOv6 model trained on the training set on the test set, and save the weights of the model with the best performance. S25. When using the model for testing in the future, save the position of the element's rectangle. The position of the element is represented by the center of the rectangle. S3. Classify the angles of graphic elements, specifically as follows: The primitives detected through the above steps are cropped using OpenVC and saved as images. Then, all primitives are rotated by three angles (90°, 180°, 270°) or one angle (90°, symmetrical primitives have only two angles) and saved as the original dataset. The dataset is divided into training and test sets and angle classification is performed using a typical classification neural network. Considering the complexity of the data, a shallow ResNet12 network is used here. S4. Connector topology detection, specifically: S41. Use OpenCV to manipulate the positions of the primitives and text obtained in the above steps, and crop all the images and text so that only the connecting lines remain in the wiring diagram. S42. Process the station wiring diagram image using filtering and binarization algorithms in OpenCV; then use template matching algorithms to detect the connecting lines. The specific steps are as follows: S421. The template has multiple style settings, including "I" type, "T" type and "+" type templates; S422. For points that are horizontally or vertically identical, connect the two closest points by calculating their coordinate distance. S423. Record the connecting line using the coordinates of its two endpoints; S5. Find the nearest connecting line based on the direction indicated by the angle of the graphic element; then determine the position of the nearest endpoint of the connecting line based on the center position of the text rectangle, thereby completing the matching of the connecting line, text, and graphic element; S6. Generate formatted text based on the information from the above process.
2. The method for detecting plant wiring diagrams based on YOLOv6 and traditional image processing technology according to claim 1, characterized in that: The CRNN model in S1 uses a pre-trained model that can generate text and text location without local training.
3. The method for detecting plant wiring diagrams based on YOLOv6 and traditional image processing technology according to claim 1, characterized in that: The formatted text in S6 includes primitive category, primitive position, text content, text position, connector endpoint position, and topological relationship between connector and primitive and text, etc.
Citation Information
Patent Citations
Text detection post-processing method based on geometrical characteristics
CN111832497A
Deep learning-based face feature point detection method
WO2022151535A1